﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter7.Section1
{
    public class Example02
    {
        public Example02()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double, double[]> ff
                = new V.Function.ToLastType<double, double[]>(func);
            V.Path c = new V.Path(ff);
            c.ParameterFrom = 0.0;
            c.ParameterTo = Math.PI / 2.0;
            V.Function.ToLastType<double[], double> fff
                = new V.Function.ToLastType<double[], double>(f);
            V.PathIntegral obj = new V.PathIntegral(fff, c);
            obj.Compute();
            result += obj.Result.ToString() + "\r\n";

            double res = 225.0;
            result += res.ToString() + "\r\n";
        }
        private double[] func(double t)
        {
            double[] x = new double[2];
            x[0] = 30.0 * Math.Cos(t) * Math.Cos(t) * Math.Cos(t);
            x[1] = 30.0 * Math.Sin(t) * Math.Sin(t) * Math.Sin(t);
            return x;
        }
        private double f(double[] x)
        {
            return 1.0 + x[1]/3.0;
        }
    }
}
/* 
224.999999999213
225
*/


